<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=s, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <my-con></my-con>
        <test></test>
    </div>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.12/vue.js"></script>
    <script type="text/javascript">
        Vue.component('MyCon',{
            template:`
                <div style="border: 1px solid rebeccapurple">
                    <h1>局部组件使用</h1>
                    <h1>{{msg}}</h1>
                </div>
                `,
                data(){
                    return {
                        msg:'3月7日学习'
                    }
                }
        })
        var vm = new Vue({
            el:'#app',
            components:{
                //局部组件  "组件对象":{选项对象}
                "test":{
                    template:
                    `
                        <div>
                            <h3 style="background-color: red;">这是app实例下的组件</h3>
                            <h3>{{aaa}}</h3>
                        </div>
                    `,
                    data(){
                        return{
                            aaa:'局部组件使用'
                        }
                    }                    
                }
            }                 
        });    
    </script>
</body>
</html>